package com.oa.dao.user.impl;

import java.util.List;

import org.springframework.orm.hibernate3.support.HibernateDaoSupport;

import com.oa.dao.user.UserDao;
import com.oa.model.User;

public class UserDaoHibernate extends HibernateDaoSupport implements UserDao {

	public User find(int id) {
		User user = (User)this.getHibernateTemplate().load(User.class, id);
		return user;
	}

	public List<User> findAll() {
		List<User> userList = (List<User>) this.getHibernateTemplate().loadAll(User.class);
		return userList;
	}

	public void remove(int id) {
		User user = (User)this.getHibernateTemplate().load(User.class, id);
		this.getHibernateTemplate().delete(user);
		
	}

	public void save(User user) {
		this.getHibernateTemplate().save(user);
	}

}
